/**
 * 
 */
package com.google.code.cisx.wfe.model;

import java.util.UUID;

/**
 * @author <a href='mailto:rthakur@bravurasolutions.com'>Rahul Thakur</a>
 * @since 1.0
 * @version $Id$
 */
public abstract class AbstractPetriNetEntity<T> implements PetriNetEntity<T> {

    /**
     * Univerally Unique Identifier that represents a 128-bit value.
     * <p>
     * This is used by the workflow engine internally.
     * 
     * @see <a
     *      href='http://java.sun.com/j2se/1.5.0/docs/api/java/util/UUID.html'>J
     *      D K 5.0 docs</a>
     */
    private UUID uuid;

    /**
     * Human readable label.
     */
    private String label;

    private T data;

    /**
     * 
     */
    public AbstractPetriNetEntity(String label) {
        super();
        uuid = UUID.randomUUID();
        this.label = label;
    }

    /**
     * {@inheritDoc}
     * 
     * @see com.google.code.cisx.wfe.model.PetriNetEntity#getId()
     */
    @Override
    public UUID getId() {
        // TODO Auto-generated method stub
        return this.uuid;
    }

    /**
     * {@inheritDoc}
     * 
     * @see com.google.code.cisx.wfe.model.PetriNetEntity#getLabel()
     */
    public String getLabel() {
        return this.label;
    }

    /**
     * {@inheritDoc}
     * 
     * @see com.google.code.cisx.wfe.model.PetriNetEntity#getData()
     */
    @Override
    public T getData() {
        return this.data;
    }

    /**
     * {@inheritDoc}
     * 
     * @see com.google.code.cisx.wfe.model.PetriNetEntity#setData(java.lang.Object)
     */
    @Override
    public void setData(T data) {
        this.data = data;
    }

}
